<html>
<head>
	<meta charset='utf-8' />
	<title>商户管理</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<style>
		@media screen and (max-width:450px){
			#Content,#Nav_bottom,#Back_Btn{width:98%;margin:0 auto}

			/*页面宽度900以下时 .abc的宽度为450*/
		}
		@media screen and (min-width:450px){
			#Content,#Nav_bottom,#Back_Btn{width:450px;margin:0 auto}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
	</style>
</head>
<body style='padding:0;margin:0;background:#eaa'>



	<!-- 1 Content容器 -->
	<div id='Content' >
		<div id='loginArea' style='display:nones'>
			<div style='font-size:14px;margin:10px;color:#589'>
				<span style='cursor:pointer' onclick='_changeCounty()'>
					当前区域：<span id='current_city'>xxx</span>　<span>切换</span>
				</span>
			</div>

			<h2 style='color:red;text-align:center'>商户登陆</h2>


			<div style='text-indent:80px;'>
				账　号：<input id='Login_User' style='width:230px'/>
			</div>

			<div style='text-indent:80px;margin:20px auto'>
				密　码：<input id='Login_Pwd' type='password' style='width:230px'/>
			</div>


			<!--div style='text-indent:80px;margin:20px auto'>
				验证码：<input id='Login_Code' style='width:70px'/>
				<img src="interface.php?type=code" align='top' alt="点击" style='width:100px;height:40px' id="Login_Code" onclick="ChangeCode(this)">
			</div-->

			<div style='text-align:center'>
				<button  id='Login_Sub'>登陆</button>
				<button  onclick='location.href="register.html"'>注册</button>
			</div>
			
			<div style='font-size:12px;text-align:center;color:#79a;line-height:50px' id='findPwdBtn'>忘记密码了</div>
		</div>
		

		<div id='findArea' style='display:none'>
			<h1 style='text-align:center'>找回密码</h1>
			
			<div style='text-indent:80px;' id='findAreaAcount'>
				账号：<input id='findAccount' style='width:230px'/>
				<button id='findAreaAcountSub'>提交</button>
			</div>

			<div style='text-indent:80px;display:none' id='question'>
				密保问题：<span id='findQuestion'><span>
			</div>
			<div style='text-indent:80px;display:none' id='answer'>
				密保答案：<input id='findAnswer' style='width:230px'/>
				<button id='findAnswerSub'>找回 </button>
			</div>
			<div style='text-align:center;margin:30px'><button onclick='_findBack()'>返回</button></div>
		</div>



		<div id='Notice'></div>
		


	</div><!-- 1 Content容器结束 -->



</body>
</html>




<script src='../Public/jquery.js'></script>
<script src='../Public/fun.js'></script>
<script src='../Public/store.js'></script>

<script>
	var view = 1;
	//切换城市
	function _changeCounty(){
		sessionStorage.changeCount = 1;		//标记切换城市
		location.replace("index.html")
	}


	var cityInfo = _store_getCurrentCityInfo();	//获取当前缓存的城市信息
	if(view)C(cityInfo);


	var requestAddr = _store_getServerAddr();	//获取缓存的后台请求地址

	$('#current_city').text(cityInfo[3]);

	$('#Login_Sub').click(function(){
		Notice('登陆中...');
		var user = ChangeChar($('#Login_User').val().trim());
		var pwd = ChangeChar($('#Login_Pwd').val().trim());
		//var code = ChangeChar($('#Login_Code').val().trim());
		if(!user || !pwd){
			//A('缺少必填项！');
		}

		if(!/^[a-z]\w{4,19}$/.test(user)){
			//A('登陆名非法!');return;
		}
		var data = {
			type:'storeLogin',
			user:user,
			pwd:pwd,
			db_host:cityInfo[1],
			db_name:cityInfo[2],
			cityCode:cityInfo[0]
		};
		Ajax(data,function(res){
			Notice('');
			if(res == 'false'){
				A('服务器繁忙，请稍候再试！');return;
			}
			var tmp = _checkJsonFormat(res,1); //检测JSON格式
			if(tmp.stat == 'err2'){
				A('用户名或密码不正确！');err
			}else{
				if(tmp.data.stat == 1 || tmp.data.stat == 2 || tmp.data.stat == 3){
					sessionStorage.store_user_info= JSON.stringify(tmp.data);	//缓存登陆账号信息
					location.replace('main.html');
				}else{
					if(tmp.data.stat == 1){
						A('商户审核中！');
					}
					if(tmp.data.stat == 4){
						A('商户已封禁！');
					}
				}
				
			}
			C(tmp.data.stat);re
		},requestAddr);
	});








	//找回密码相关
	$('#findPwdBtn').click(function(){
		$('#loginArea').hide();
		$('#findArea').show();
	});

	function _findBack(){	//返回
		$('#loginArea').show();
		$('#findArea').hide();
		$('#findAreaAcount').show();
		$('#question,#answer').hide();
		$('#findAccount,#findAnswer').val('');
	}

	$('#findAreaAcountSub').click(function(){	//提交账号
		var faccount = ChangeChar($('#findAccount').val().trim());
		if(!faccount){
			return;
		}
		var data = {
			type:'findQuestion',
			user:faccount,
			db_host:cityInfo[1],
			db_name:cityInfo[2],
			cityCode:cityInfo[0]
		};
		Ajax(data,function(res){
			if(res && res != 'err'){
				$('#findAreaAcount').hide();
				$('#question,#answer').show();
				$('#findQuestion').text(res);
			}else{
				A('账号输入错误！');
			}
		},requestAddr);
	});


	$('#findAnswerSub').click(function(){	//找回密码
		var faccount = ChangeChar($('#findAccount').val().trim());
		var answer_val = ChangeChar($('#findAnswer').val().trim());
		var data = {
			type:'findPwd',
			user:faccount,
			answer:answer_val,
			db_host:cityInfo[1],
			db_name:cityInfo[2],
			cityCode:cityInfo[0]
		};
		C(data);
		Ajax(data,function(res){
			C(res);
			if(res && res != 'err'){
				_findBack();
				A('密码已重置为：'+res);
			}else{
				A('密保答案不正确！');
			}
		},requestAddr);
	});



</script>










